package game.utils.drawing 
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.DisplayObject;
	import flash.display.Graphics;
	import flash.display.Sprite;
	/**
	 * ...
	 * @author Thot
	 */
	public class Drawing 
	{
		
		static private var _sprite:Sprite = new Sprite();
		
		public function Drawing() { }
		
		
		static public function reset():void
		{
			_sprite = new Sprite();
		}
		
		static public function get graphics():Graphics
		{
			return _sprite.graphics;
		}
		
		static public function get sprite():Sprite
		{
			return _sprite;
		}
		
		static public function removeChildren():void
		{
			while ( _sprite.numChildren > 0 )
			{
				_sprite.removeChildAt(0);
			}
		}
		
		static public function clear():void
		{
			_sprite.graphics.clear();
		}
		
		static public function clean():void
		{
			removeChildren();
			_sprite.graphics.clear();
		}
		
		static public function get snapshot():Bitmap
		{
			var data:BitmapData = new BitmapData( _sprite.width, _sprite.height, true, 0x00000000 );
			var bmp:Bitmap = new Bitmap(data);
			
			data.draw( _sprite );
			
			return bmp;
		}
		
	}

}